package sv.gob.mh.dgii.model;

// Generated Dec 12, 2007 1:25:05 PM by Hibernate Tools 3.2.0.CR1

import java.util.Date;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * CdHistMov generated by hbm2java
 */
@Entity
@Table(name = "CD_HIST_MOV", schema = "CTROLDOC")
public class CdHistMov implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -6381064102007081245L;
	private CdHistMovId id;
	private TbUnidad tbUnidad;
	private CdDocumento cdDocumento;
	private String cusuario;
	private Date fhingreso;
	private Date fhfasignacion;

	public CdHistMov() {
	}

	public CdHistMov(CdHistMovId id, CdDocumento cdDocumento, String cusuario) {
		this.id = id;
		this.cdDocumento = cdDocumento;
		this.cusuario = cusuario;
	}

	public CdHistMov(CdHistMovId id, TbUnidad tbUnidad,
			CdDocumento cdDocumento, String cusuario, Date fhingreso,
			Date fhfasignacion) {
		this.id = id;
		this.tbUnidad = tbUnidad;
		this.cdDocumento = cdDocumento;
		this.cusuario = cusuario;
		this.fhingreso = fhingreso;
		this.fhfasignacion = fhfasignacion;
	}

	@EmbeddedId
	@AttributeOverrides( {
			@AttributeOverride(name = "ndocumento", column = @Column(name = "N_DOCUMENTO", nullable = false, length = 12)),
			@AttributeOverride(name = "fhiasignacion", column = @Column(name = "FHI_ASIGNACION", nullable = false, length = 7)) })
	public CdHistMovId getId() {
		return this.id;
	}

	public void setId(CdHistMovId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "C_UNIDAD")
	public TbUnidad getTbUnidad() {
		return this.tbUnidad;
	}

	public void setTbUnidad(TbUnidad tbUnidad) {
		this.tbUnidad = tbUnidad;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "N_DOCUMENTO", nullable = false, insertable = false, updatable = false)
	public CdDocumento getCdDocumento() {
		return this.cdDocumento;
	}

	public void setCdDocumento(CdDocumento cdDocumento) {
		this.cdDocumento = cdDocumento;
	}

	@Column(name = "C_USUARIO", nullable = false, length = 30)
	public String getCusuario() {
		return this.cusuario;
	}

	public void setCusuario(String cusuario) {
		this.cusuario = cusuario;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "FH_INGRESO", length = 7)
	public Date getFhingreso() {
		return this.fhingreso;
	}

	public void setFhingreso(Date fhingreso) {
		this.fhingreso = fhingreso;
	}

	//@Temporal(TemporalType.DATE)
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "FHF_ASIGNACION", length = 7)
	public Date getFhfasignacion() {
		return this.fhfasignacion;
	}

	public void setFhfasignacion(Date fhfasignacion) {
		this.fhfasignacion = fhfasignacion;
	}

}
